const router = require('koa-router')()
const schoolCtrl = require('../controllers/schoolCtrl')
const userCtrl = require('../controllers/userCtrl')
const projCtrl = require('../controllers/projCtrl')
const { verifyProjParams } = require('../middleware/verify.params')

router.get('/', async (ctx, next) => {
  await ctx.render('home', {
    title: 'home 路由菜单'
  })
})


router.get('/school', schoolCtrl.getSchool)

router.get('/deplist',schoolCtrl.getDeplist)

router.post('/ulogin', userCtrl.ulogin)

router.post('/projList', verifyProjParams, projCtrl.getprojList)

router.get('/deplistCount',projCtrl.deplistCount)
 


module.exports = router

/**
 * 
 * @api {get} /home/deplist 学院列表
 * @apiName 学院列表
 * @apiGroup 学校信息
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} schooId 学校id
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
*  {
 *    "code": 0,
 *    "msg": "success",
 *    "data": [{
 *            depName:'',
 *            depId:''
 *          }
 *              ]
 * }
 * 
 */

/**
 * 
 * @api {post} /home/projList 获取项目列表
 * @apiName 获取项目列表
 * @apiGroup 发布管理
 * @apiVersion  1.0.1
 * 
 * @apiParam  {String} grade 年级
 * @apiParam  {Number} department 学院id
 * @apiParam  {String} projName 项目名称
 * @apiParam  {Number} schoolId 学校id
 * @apiParam  {Number} sortId 分类id
 * @apiParam  {Number} limit 一页条数
 * @apiParam  {Number} page 页码
 * @apiParam  {Number} userId 用户id
 * @apiParam  {Array} num 招聘人数
 * 
 * @apiParamExample  {type} Request-Example:
 * {
 *   sortId : 3
 *   grade ： '',
 *   userId：''
 *   department : 1
 *   projName : ''
 *   schoolId : ''
 *   limit : 10
 *   page : 1
 *   num : [1,6]
 * }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 *  {
 *    "code": 0,
 *    "msg": "success",
 *    "data": [
 *        {
 *            "projId": 1, 
 *            "userId": 3,
 *            "sortId": 3, // 分类id
 *            "grade": "2003", // 年级
 *            "department": 3, // 学院id
 *            "num": 3, // 招人数
 *            "commNum": 3, // 评论人数
 *            "projDesc": "3", // 描述
 *            "projName": "3", // 名称
 *            "look": 0, // 浏览量
 *            "createTime": "2022-11-19T09:16:01.000Z", // 创建时间
 *            "schoolId": 1
 *        },
 *        {
 *            "projId": 2,
 *            "userId": 3,
 *            "sortId": 2,
 *            "grade": "2009",
 *            "department": 2,
 *            "num": 6,
 *            "commNum": 3,
 *            "projDesc": "asdd",
 *            "projName": "2234",
 *            "look": 0,
 *            "createTime": "2022-11-19T10:21:02.000Z",
 *            "schoolId": 1
 *        },
 *      ]
 * 
 * 
 */
/**
 * 
 * @api {get} /home/school 获取学校列表
 * @apiName 获取学校列表
 * @apiGroup 学校信息
 * @apiVersion 1.0.1
 * 
 * @apiSuccessExample {type} Success-Response:
 *  {
 *      "code": 0,
 *      "msg": "success",
 *      "data": [
 *          {
 *              "schoolId": 1,
 *              "schoolName": "wyu"
 *          }
 *      ]
 *  }
 * 
 * 
 */

/**
 * 
 * @api {post} /home/ulogin 用户登录
 * @apiName 用户登录
 * @apiGroup 用户
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} code 小程序用户登录码
 * @apiParam  {String} nickName 微信名称
 * @apiParam  {Number} gender 性别, 男0 女1
 * @apiParam  {String} avatarUrl 头像
 * 
 * 
 * @apiParamExample  {json} Request-Example:
 * {
 *    code:'',
 *    nickName:'zs',
 *    gender:0,
 *    avatarUrl:''
 * }
 * 
 * 
 * @apiSuccessExample {json} Success-Response:
 *  {
 *      "code": 0,
 *      "message": "success",
 *      "data": {
 *          "userId": 12,
 *          "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVbmlvbklEIjoxMiwiaWF0IjoxNjY4ODM4MzcwLCJleHAiOjE2Njg5MjQ3NzB9.Mc620xVkoK2g5HlzmaT6L_RFNQuSx3MF0R2uOdJtXtc"
 *      }
 *  }
 * 
 * 
 */